package jp.bluecab.bluecabsystem.util;

import java.util.List;

import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.content.Context;

public class CommonFunc {
	
	/*
	 * サービス起動中確認
	 */
	public boolean isServiceRunning(Context c, Class<?> cls) {
		ActivityManager am = (ActivityManager) c.getSystemService(Context.ACTIVITY_SERVICE);
		List<RunningServiceInfo> runningService = am.getRunningServices(Integer.MAX_VALUE);
		for (RunningServiceInfo info : runningService) {
			SdLog.put("service: " + info.service.getClassName() + " : " + info.started);
			if (cls.getName().equals(info.service.getClassName())) {
				return true;
			}
		}
		return false;
		
	}
}
